<template>
  <smart-page>
    <template #search>
      <smart-search :query-array="QUESTIONNAIRE_SEARCH" @on-handler="onSearch"/>
    </template>
    <a-table v-model:selectedKeys="selectedKeys"
             :table-layout-fixed="theme.layoutFixed"
             :columns="QUESTIONNAIRE_COLUMNS"
             :row-key="rowKey"
             :column-resizable="theme.resizable"
             :bordered="theme.bordered"
             :stripe="theme.stripe"
             :sticky-header="theme.sticky"
             :hoverable="theme.hoverAble"
             :pagination="pagination"
             :loading="theme.loading"
             :data="dataSource"
             @page-change="onPageChange"
             @page-size-change="onPageSizeChange">
      <template #sex="{record}">
        {{ record.sex === 1 ? '男' : record.sex === 2 ? '女' : '保密' }}
      </template>

      <template #action="{ record }">
        <a-space size="mini"  >
          <a-link @click="readCtr.open(record)"> 详情</a-link>
        </a-space>
      </template>
    </a-table>
  </smart-page>
  <read-modal v-if="readCtr.show" :record="readCtr.record" @cancel="readCtr.close"/>
</template>
<script lang="ts" setup name="pop-dis-level">
import {onMounted} from 'vue';

import {QUESTIONNAIRE_SEARCH} from '../resource/search'
import {QUESTIONNAIRE_COLUMNS} from "../resource/colums";
import {TablePage} from "@/libs/core";
import {PopBasicHttp} from "../resource/http";
import ReadModal from './read.vue'
import {Acl} from "@/libs/acl";

const pageConfig = {title: '', rowKey: 'id', nameKey: 'name'}
const {getQuestionnaireList} = PopBasicHttp
const tablePage = new TablePage(pageConfig).setFetchXhr(getQuestionnaireList).setPermission(Acl.POP_DIS_QUESTIONNAIRE_PAGE_LIST);
const {theme, pagination, rowKey, dataSource, selectedKeys} = tablePage
const {onFetch, onPageChange, onPageSizeChange, onSearch,readCtr} = tablePage
onMounted(() => onFetch())
</script>

